{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>历史工单列表</legend>
    </fieldset>
    <div class="demoTable">
        <div class="layui-inline">
            <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}编号或关键字">
        </div>
        <button class="layui-btn" id="search" data-type="reload">{:lang('search')}</button>

    </div>
    <table class="layui-table" id="list" lay-filter="list"></table>
</div>
{include file="common/foot"/}
<script type="text/html" id="option">

    <a class="layui-btn layui-btn-xs" lay-event="info" >详情</a>

</script>

<script>

    layui.use('table', function() {
        var table = layui.table, $ = layui.jquery;
        var tableIn = table.render({
            id: 'works',
            elem: '#list',
            url: '{:url("queryPage")}',
            method: 'post',
            where:{state_id:'13,14'},
            page: true,
            cols: [[
                {checkbox: true, fixed: true},
                {field: 'number', title: '{:lang("id")}', width: 180,fixed: true},
                {field: 'title', title: '标题', width: 180},
                {field: 'tel', title: '{:lang("tel")}', width: 180},
                {field: 'desc', title: '描述', width: 300},
                {field: 'address', title: '地址', width: 150},
                {field: 'type_name', title: '类型', width: 120},
                {field: 'fault_name', title: '故障类型', width: 180},
                {field: 'state_name', title: '状态', width: 80},
                {width: 180, align: 'center', toolbar: '#option'}
            ]],
            limit: 10 //每页默认显示的数量
        });
        //搜索
        $('#search').on('click', function () {
            var key = $('#key').val();
            if ($.trim(key) === '') {
                layer.msg('{:lang("pleaseEnter")}关键字！', {icon: 0});
                return;
            }
            tableIn.reload({
                where: {key: key,state_id:'13,14'}
            });
        });
        table.on('tool(list)', function(obj) {
            var data = obj.data;
            if (obj.event === 'info') {
                //data 详情
            }
        });

    });
</script>